import { getCate } from "@/utils/api/homeapi";
const topCategory=[
  '居家',
  '美食',
  '服饰',
  '母婴',
  '个护',
  '严选',
  '数码',
  '运动',
  '杂货'
]
export default {
  namespaced: true,
  state: {
    cate: topCategory.map(item=>{return{name:item}}),
    nowcateindex:null
  },
  mutations: {
    // 设置cate
    setCate(state, arr) {
      state.cate = arr;
    },
    setCateIndex(stete,key){
      stete.nowcateindex=key
    }
  },
  actions: {
  async  asyncSetCate({commit}) {
    let res =await getCate()
      commit('setCate',res.result)
    },
  },
};
